package com.example.chapter3.config;




import com.example.chapter3.pojo.BussinessPerson;
import com.example.chapter3.pojo.User;
import com.example.chapter3.pojo.definition.Person;
import com.example.chapter3.scope.pojo.ScopeBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class IoCTest {

    public static void main(String[] args) {
//        ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
//        User user = ctx.getBean(User.class);
//        System.out.println(user.getId());

//        Person person = ctx.getBean(BussinessPerson.class);
//        person.service();

//        ctx.close();

        System.out.println("===============================");
        ScopeBean scopeBean1 = ctx.getBean(ScopeBean.class);
        ScopeBean scopeBean2 = ctx.getBean(ScopeBean.class);

        System.out.println(scopeBean1 == scopeBean2);
    }
}
